//
//  XHShopCartManager.h
//  xinhua
//
//  Created by fengyn on 15/11/24.
//  Copyright © 2015年 lexingsoft. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface XHShopCartManager : NSObject
///购物车中所有商品信息
@property (strong, nonatomic, readonly) NSMutableArray *productArray;
///购物车中所有商品数量字典(商品id:count)
@property (strong, nonatomic, readonly) NSMutableDictionary *productCountDic;

/// 获取使用实例
+ (instancetype )sharedInstance;

/// 初始化Manager
- (void) initManager;

/// 增加一个商品至购物车(数量+1)
- (void)addOneProduct:(NSDictionary *)productInfoDic;

/// 从购物车去掉一个商品(数量-1)
- (void)removeOneProduct:(NSDictionary *)productInfoDic;

/// 从购物车中彻底删除一个商品
- (void)removeTheProduct:(NSDictionary *)productInfoDic;

/// 清除购物车中已经结算的商品
- (void)removeSelectedProduct;

/// 清空购物车
- (void)clearAllProduct;

/// 获取购物车中对应商品数量
- (NSInteger)numberOfProduct:(NSDictionary *)productInfoDic;

/// 获取购物车中商品总数
- (NSInteger)numberOfAllProduct;

/// 获取购物车商品总价
- (double)priceOfAllProduct;

/// 获取购物车中选中商品总价
- (double)priceOfAllSelectedProduct;

/// 获取购物车中选中商品
- (NSArray *)selectedProductInfoArray;

/// 获取购物车中选中商品数量
- (NSDictionary *)selectedProductCountDic;

/// 是否选中
- (BOOL)isSelectedProduct:(NSDictionary *)productInfoDic;

/// 设置是否选中些商品
- (void)setProduct:(NSDictionary *)productInfoDic isSelected:(BOOL)isSelected;
@end
